#[macro_export]
macro_rules! dispatch_by_dtype {
  ($dt:expr, |$T:ident| $body:block,
   $( $case:path => $ty:ty ),+ $(,)?
  ) => {{
      match $dt {
        $( $case => { type $T = $ty; $body } ),+,
        _ => Err($crate::ops::ops_error::OpsError::TypeMismatch("unsupported dtype in dispatch_by_dtype")),
      }
  }};
}
